entry: get_icon_area returns in entry coordinates
authorTimm Bäder <mail@baedert.org>
Thu, 3 Aug 2017 09:14:53 +0000 (11:14 +0200)
committerTimm Bäder <mail@baedert.org>
Thu, 3 Aug 2017 09:14:53 +0000 (11:14 +0200)
This fixes the popover positions in the gtk4-demo/popovers, and it also
just makes sense. Also document what the returned coordinates are
relatiev to.

gtk/gtkentry.c

index 1d8223a3d9bd4d5085604a78975bb2e238eac210..b33f4fdced7280de6bafee3b5969f72d208f8b0b 100644 (file)
@@ -8044,7 +8044,8 @@ gtk_entry_get_current_icon_drag_source (GtkEntry *entry)
  * entry in a draw callback.
  *
  * If the entry is not realized or has no icon at the given position,
- * @icon_area is filled with zeros.
+ * @icon_area is filled with zeros. Otherwise, @icon_area will be filled
+ * with the icon's allocation, relative to @entry's allocation.
  *
  * See also gtk_entry_get_text_area()
  *
@@ -8067,11 +8068,7 @@ gtk_entry_get_icon_area (GtkEntry             *entry,
 
   if (icon_info)
     {
-      GtkAllocation widget_allocation;
-      gtk_widget_get_allocation (GTK_WIDGET (entry), &widget_allocation);
-      gtk_widget_get_border_allocation (icon_info->widget, icon_area);
-      icon_area->x -= widget_allocation.x;
-      icon_area->y -= widget_allocation.y;
+      gtk_widget_get_outer_allocation (icon_info->widget, icon_area);
     }
   else
     {